package com.alibaba.itu.tala.event;

import org.eclipse.ui.IWindowListener;
import org.eclipse.ui.IWorkbenchPage;
import org.eclipse.ui.IWorkbenchWindow;

import com.alibaba.itu.tala.util.TalaLogger;

public class WindowListenerAdapter implements IWindowListener {

    /** Tala logger */
    private TalaLogger log = TalaLogger.getLogger();

    /**
     * @see org.eclipse.ui.IWindowListener#windowActivated(org.eclipse.ui.IWorkbenchWindow)
     */
    public void windowActivated(IWorkbenchWindow window) {

    }

    /**
     * @see org.eclipse.ui.IWindowListener#windowDeactivated(org.eclipse.ui.IWorkbenchWindow)
     */
    public void windowDeactivated(IWorkbenchWindow window) {

    }

    /**
     * @see org.eclipse.ui.IWindowListener#windowClosed(org.eclipse.ui.IWorkbenchWindow)
     */
    public void windowClosed(IWorkbenchWindow window) {
        log.debug("the window was closed.");
    }

    /**
     * @see org.eclipse.ui.IWindowListener#windowOpened(org.eclipse.ui.IWorkbenchWindow)
     */
    public void windowOpened(IWorkbenchWindow window) {
        log.debug("New window was opened.");
        IWorkbenchPage page = window.getActivePage();
        try {
            page.addSelectionListener(new ReviewSelectionListener());
            //page.addPartListener(new MarkerTextPartListener());
        } catch (NullPointerException e) {
            log.warning("Could not register either selection listener or part listener.");
        }
    }

}
